package boun.swe.bob.entities;

import javax.persistence.*;

/**
 * This entity corresponds to friends table
 */
@Entity
@IdClass(FriendsPK.class)
@Table(name = "friends")
public class Friend {

    @Id
    @Column(name = "user1_id")
    private Integer user1Id;

    @Id
    @Column(name = "user2_id")
    private Integer user2Id;

    @Column(name = "approved")
    private Integer approved;

    @OneToOne
    @JoinColumn(name = "user2_id", referencedColumnName = "user_id", insertable = false, updatable = false)
    public User friend;

    public Integer getUser1Id() {
        return user1Id;
    }

    public void setUser1Id(Integer user1Id) {
        this.user1Id = user1Id;
    }

    public Integer getUser2Id() {
        return user2Id;
    }

    public void setUser2Id(Integer user2Id) {
        this.user2Id = user2Id;
    }

    public Integer getApproved() {
        return approved;
    }

    public void setApproved(Integer approved) {
        this.approved = approved;
    }

    public User getFriend() {
        return friend;
    }

    public void setFriend(User friend) {
        this.friend = friend;
    }
}
